/*
 * ModifyUser.h
 *
 *  Created on: 2013-1-30
 *      Author: Administrator
 */

#ifndef MODIFYUSER_H_
#define MODIFYUSER_H_
#include <QDialog>
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QComboBox>
#include <QCheckBox>
#include <qwidget.h>
#include <QGridLayout>
#include "../bo/User.h"
#include <QDebug>
//enum{addMode = 0, modifyMode = 1};
class ModifyUser:public QDialog
{
	Q_OBJECT
public:
	enum{addMode = 0, modifyMode = 1};
	ModifyUser(QWidget *parent = 0);
	virtual ~ModifyUser();
	void setMode(int mode);
	void setUi(const int &id = 0, const QString &name = 0, const QString &loginName = 0, const int &type = 0,
			   const bool &locked = 0, const QString &password = 0);
signals:
	void sig_modifyOrAdd(const int &mode, const int &id, const QString &name, const QString &loginName,
			const int &type, const bool &locked, const QString &password);
private slots:
	void slt_modifyOrAdd();
private:
	QLabel nameLabel, userTypeLabel, passwdLabel, loginLabel;
	QLineEdit nameLineEdit, passwdLineEdit, loginLineEdit;
	QComboBox userTypeComoboBox;
	QCheckBox lockCheckBox;
	QPushButton modifyButton, cancleButton;
//	User user;
	QGridLayout layout;
	int mode, id;
};

#endif /* MODIFYUSER_H_ */
